import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Pipe({
    name: 'safeReform',
    pure: false
})
// bool值转换通道
export class SafePipe implements PipeTransform {
    constructor(private domSanitizer: DomSanitizer) {
    }
    transform(url: string, args?: any): any {
        if (url === null || url === '') {
            return '';
        }
        return this.domSanitizer.bypassSecurityTrustUrl(url);
    }
}
